<template>
    <div class="packages">
        <headerBar :title="title"></headerBar>
        <div class="package_list">
            <div v-for="(item, index) in list" :key="item.show_name">
                <div :class="['g_card', 'package_item', {'package_item_important': item.order >= 10}]">
                    <div class="row">
                        <div class="flex-first">
                          <div class="flex-first-left left">
                            <div class="title">
                                {{item.name}}
                            </div>
                            <div class="sub_title">
                                {{item.recommend}}
                            </div>
                          </div>
                          <div class="flex-first-right">
                            <div class="img">
                                <img v-if="item.image" :src="item.image" alt="">
                                <img src="../assets/images/default.png" alt="" v-else>
                            </div>
                          </div>
                        </div>
                    </div>
                    <div class="row padding-to-10">
                        <div class="flex-first">
                          <div class="flex-first-left left">
                            <div class="price">{{item.price / 100}} 宝石 </div>
                          </div>
                          <div class="flex-first-right">
                            <router-link :to="`/package/${item}`">
                                <router-link :to="`/package/${item.show_name}`">
                                    <van-button size="small" style="color: #222; font-size: 11px; font-weight: 500;">浏览商品</van-button>
                                </router-link>
                            </router-link>
                          </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import Bottom from "@/components/bottom";
import { getRaffles } from "@/apis/apis";
import headerBar from "@/components/headerBar";

export default {
  data() {
    return {
      list: [],
      title: '游戏包列表'
    };
  },
  components: {
    Bottom,
    headerBar
  },
  methods: {
    getRaffles() {
      getRaffles().then(res => {
        this.list = res.objects;
      });
    }
  },
  mounted() {
    this.getRaffles();
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/var.scss";

.packages {
  min-height: 100vh;
  height: 100%;
  padding-bottom: 70px;
}
.package_list {
  padding-top: 60px;
}
.packages_title {
  color: #fff;
  height: 48px;
  font-size: 18px;
  line-height: 48px;
  padding-left: 10px;
}

.package_item {
  background-image: url('../assets/images/bg-text-pattern-winter.png');
  background-repeat: repeat;
  margin: 12px 8px;
  padding: 18px 12px;
}

.package_item_important {
  border: 4px #ffc22094 solid;
}

.row {
  display: flex;
  width: 100%;
  color: #fff;
  justify-content: space-between;
}
.padding-to-10 {
  padding-top: 2px;
}
.flex-first {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
}
.left {
   padding-right: 30px;
  /*flex: 1;*/
  .title {
    font-size: 20px;
    line-height: 30px;
    font-weight: 505;
  }

  .sub_title {
    opacity: 0.7;
    color: #e5e5e5;
    font-size: 12px;
    height: 50px;
  }

  .price {
    color: $yellow;
    font-size: 16px;
  }
}

img {
  max-width: 115px;
  max-height: 52px;
  height: 52px;
  width: 115px;
  border: 1px #999 solid;
  border-radius: 5px;
}

.right {
  flex-basis: 100px;
  text-align: center;
  margin: 10px 8px;

  .van-button {
    width: 70px;
    color: #fff;
    margin-top: 19px;
  }
}
</style>
